package netbay;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

public class FileDao {

	public void copyFile(File sourceFile, File destFile) throws IOException {
		if (!destFile.exists()) {
			destFile.createNewFile();
		}

		FileChannel source = null;
		FileChannel destination = null;

		source = new FileInputStream(sourceFile).getChannel();
		destination = new FileOutputStream(destFile).getChannel();

		if (source != null) {
			destination.transferFrom(source, 0, source.size());
			source.close();
			destination.close();
		}

	}

	public boolean deleteFile(File delFile) {
		return delFile.delete();
	}

	public String[] exploreFolder(File expFolder) {
		return expFolder.list();
	}

}